import request from '@/utils/request'

// 目录请求数据
export const getContent = params => {
  return request({
    method: 'GET',
    url: '/directorys',
    params
  })
}
// 目录状态的变化
export const changeContentState = data => {
  return request({
    method: 'POST',
    url: `/directorys/${data.id}/${data.state}`,
    data
  })
}
// 下拉目录
export const dropDirectory = subjectName => {
  return request({
    method: 'GET',
    url: '/subjects/simple',
    subjectName
  })
}
// 新增目录
export const addContentItem = data => {
  return request({
    method: 'POST',
    url: '/directorys',
    data
  })
}
// 修改目录
export const amendContentItem = data => {
  return request({
    method: 'PUT',
    url: `/directorys/${data.id}`,
    data
  })
}
// 删除目录
export const deleteContentItem = id => {
  return request({
    method: 'DELETE',
    url: `/directorys/${id}`,
    id
  })
}
